package com.kmzx.one.project.others.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.kmzx.one.project.config.web.Decimal2Serializer;

import java.io.Serializable;
import java.math.BigDecimal;

public class ProdOutInfo implements Serializable {

    private static final long serialVersionUID = 8232041774146567426L;

    private String prodId;

    private String prodName;

    private String prodImg;

    private String cateId;

    protected String cateName;

    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal prodPrice;

    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal currentPrice;

    // 美颜值
    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal beauty;

    // 活动种类
    // 0,无任何活动
    // 1,打折
    // 2,直升
    private int kinds;

    // false 无
    // true 有
    private boolean has;

    private int rankNum;

    private String discountImg;

    private String fastIcon;

    private Long nowNumber;

    private long sellNum;

    private String rankIcon;

    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal rankPrice;

    // 商品简称
    private String prodAbbrName;

    private boolean oneValue;

    private int sorts;

    private Integer behalf;

    protected int levels;

    private int tefan;

    public String getProdId() {
        return prodId;
    }

    public ProdOutInfo setProdId(String prodId) {
        this.prodId = prodId;
        return this;
    }

    public String getProdName() {
        return prodName;
    }

    public ProdOutInfo setProdName(String prodName) {
        this.prodName = prodName;
        return this;
    }

    public String getProdImg() {
        return prodImg;
    }

    public ProdOutInfo setProdImg(String prodImg) {
        this.prodImg = prodImg;
        return this;
    }

    public String getCateId() {
        return cateId;
    }

    public ProdOutInfo setCateId(String cateId) {
        this.cateId = cateId;
        return this;
    }

    public BigDecimal getProdPrice() {
        return prodPrice;
    }

    public ProdOutInfo setProdPrice(BigDecimal prodPrice) {
        this.prodPrice = prodPrice;
        return this;
    }

    public BigDecimal getCurrentPrice() {
        return currentPrice;
    }

    public ProdOutInfo setCurrentPrice(BigDecimal currentPrice) {
        this.currentPrice = currentPrice;
        return this;
    }

    public BigDecimal getBeauty() {
        int kinds = getKinds();
        if(kinds!=2){
            BigDecimal currentPrice = getCurrentPrice();
            BigDecimal rankPrice = getRankPrice();
            if(rankPrice!=null && rankPrice.compareTo(currentPrice)<0 && rankPrice.compareTo(BigDecimal.ZERO)!=0){
                return rankPrice;
            }
            return currentPrice;
        }
        return beauty;
    }

    public ProdOutInfo setBeauty(BigDecimal beauty) {
        this.beauty = beauty;
        return this;
    }

    public int getKinds() {
        return kinds;
    }

    public ProdOutInfo setKinds(int kinds) {
        this.kinds = kinds;
        return this;
    }

    public boolean isHas() {
        return has;
    }

    public ProdOutInfo setHas(boolean has) {
        this.has = has;
        return this;
    }

    public String getDiscountImg() {
        return discountImg;
    }

    public ProdOutInfo setDiscountImg(String discountImg) {
        this.discountImg = discountImg;
        return this;
    }

    public String getFastIcon() {
        return fastIcon;
    }

    public ProdOutInfo setFastIcon(String fastIcon) {
        this.fastIcon = fastIcon;
        return this;
    }

    public int getRankNum() {
        return rankNum;
    }

    public ProdOutInfo setRankNum(int rankNum) {
        this.rankNum = rankNum;
        return this;
    }

    public Long getNowNumber() {
        return nowNumber;
    }

    public ProdOutInfo setNowNumber(Long nowNumber) {
        this.nowNumber = nowNumber;
        return this;
    }


    public long getSellNum() {
        return sellNum;
    }

    public ProdOutInfo setSellNum(long sellNum) {
        this.sellNum = sellNum;
        return this;
    }

    public String getRankIcon() {
        return rankIcon;
    }

    public ProdOutInfo setRankIcon(String rankIcon) {
        this.rankIcon = rankIcon;
        return this;
    }

    public BigDecimal getRankPrice() {
        return rankPrice;
    }

    public ProdOutInfo setRankPrice(BigDecimal rankPrice) {
        this.rankPrice = rankPrice;
        return this;
    }

    public String getProdAbbrName() {
        return prodAbbrName;
    }

    public ProdOutInfo setProdAbbrName(String prodAbbrName) {
        this.prodAbbrName = prodAbbrName;
        return this;
    }

    public boolean isOneValue() {
        return oneValue;
    }

    public ProdOutInfo setOneValue(boolean oneValue) {
        this.oneValue = oneValue;
        return this;
    }

    public int getSorts() {
        return sorts;
    }

    public ProdOutInfo setSorts(int sorts) {
        this.sorts = sorts;
        return this;
    }


    public Integer getBehalf() {
        return behalf;
    }

    public ProdOutInfo setBehalf(Integer behalf) {
        this.behalf = behalf;
        return this;
    }

    public String getCateName() {
        return cateName;
    }

    public ProdOutInfo setCateName(String cateName) {
        this.cateName = cateName;
        return this;
    }

    public int getLevels() {
        return levels;
    }

    public ProdOutInfo setLevels(int levels) {
        this.levels = levels;
        return this;
    }

    public int getTefan() {
        return tefan;
    }

    public ProdOutInfo setTefan(int tefan) {
        this.tefan = tefan;
        return this;
    }
}
